home *** CD-ROM | disk | FTP | other *** search
- /* idexp.c function, from p. 218 of turboc bible */
- #include<stdio.h>
- #include<math.h>
- #include<stdlib.h> /* errno is defined here */
- main(int argc, char **argv)
- {
- double mantissa, result;
- int exponent;
-
- if(argc < 3)
- {
- printf("Usage: %s <mantissa> <exponent>\n", argv[0]);
- }
- else
- {
- mantissa = atof(argv[1]);
- exponent = atoi(argv[2]);
- result = ldexp(mantissa, exponent);
- if(errno != ERANGE)
- {
- printf("S raised to %s = %f\n",
- argv[1], argv[2], result);
- }
- }
- }